feat(dev-server): support allowedHosts - #178
Closed
lukekania wants to merge 2 commits into
Closed
Conversation
…lhost) (#144) Add the `allowedHosts` knob the `@angular/build:dev-server` builder exposes so projects fronted by a tunneling proxy (ngrok, Cloudflare Tunnel, GitHub Codespaces) or running under a non-default local hostname (`*.localhost`, `app.local`) don't get rejected by the dev server's `Host:` header check. * `packages/builder/schemas/dev-server.json`: add `allowedHosts: array`. * `packages/builder/src/serve/options.ts`: forward the list as `--allowed-hosts host1,host2`, normalizing empty/whitespace entries and case-insensitively deduping. * `crates/cli`: new `--allowed-hosts` flag on `ngc-rs serve` (value delimiter `,`) wired through `serve_cmd::run` to the dev server. * `crates/dev-server`: new `AllowedHosts` resolver + filter in `handle_request`. Loopback hosts (`localhost`, `127.0.0.1`, `[::1]`) are always allowed. The literal `"all"` disables the check entirely; `"auto"` (or an empty list, the default) additionally accepts the bound host. Anything else is an exact, case-insensitive hostname match with the `Host:`-header port stripped before comparison. Mismatches respond with a 403 whose body names the offending host and points at both the angular.json option and the CLI flag. Bumps workspace version to 0.10.12.
Owner
Author
|
Superseded by #173 (reopened) which has the full PR description. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #144.